import type{UserType,CodeType,Code,UserInfoType,PatientListType,PatientType} from '@/types/user'
import {request} from '@/utils/request'

//密码登录
export const loginByPasswordAPI = (mobile:string,password:string) => request<UserType>(
    '/login/password','POST',{mobile,password}
)

//发送验证码
export const sendMobileCodeAPI = (mobile:string,type:CodeType) => request<Code>('/code','GET',{mobile,type})

//手机验证码登录
export const loginByMobilAPI = (mobile:string,code:string)=> request<UserType>('/login','POST',{mobile,code})

//注册
export const registerAPI = (mobile:string,code:string,password:string)=>request<UserType>('/register','POST',{mobile,code,password})


//获取用户信息
 export const getUserInfoAPI =()=>request<UserInfoType>('/patient/myUser','GET')

 //获取家庭档案-患者列表
 export const getPatientListAPI = () => request<PatientListType>('/patient/mylist')

 //添加患者
 export const addPatientAPI = (patient:PatientType) => request('/patient/add','POST', patient)

 //编辑患者
 export const editPatientAPI = (patient:PatientType)=> request('/patient/update','PUT',patient)

 //删除患者
 export const delPatientAPI = (id:string) => request(`/patient/del/${id}`,'DELETE')


    
